<?php
/**
 * product class. Provide all utilities function related to 
 * product table.
 * <u>Note:</u> all $db param in first parameter is ezMySQL object.
 * See ezSQL documentation for more information.
 */
class FIN_requestBean 
{
   
   /**
     * Save user information to database.
     * User information is POST values
     * field name is defined in input form
     * See smarty template for detail of name of form's element.
     */
    function saveRequest($db, $info)
    {
    	$sql = sprintf("INSERT INTO %s " .
    			"(name, dob, street, city," .
    			"zip, country, information,date) " .
    			"VALUES ('%s', '%s', '%s', '%s', '%s','%s','%s', now())", 
    			TBL_REQUEST,
    			$info['name'],
    			$info['dob'],
    			$info['street'],
    			$info['city'],
				$info['zip'],
    			$info['country'],
    			$info['information']);
    	$res = $db->query($sql);
    	if($res == true)
    	{
    		return $db->insert_id;
    	}
    	else
    		return -1;
    }
	
	 /**
     * Save user information to database.
     * User information is POST values
     * field name is defined in input form
     * See smarty template for detail of name of form's element.
     */
    function savePreRegister($db, $info)
    {
    	$sql = sprintf("INSERT INTO %s " .
    			"(name, dob, email,information,send_date) " .
    			"VALUES ('%s', '%s', '%s', '%s', now())", 
    			TBL_PRE_REGISTER,
    			$info['name'],
    			$info['dob'],
    			$info['email'],
    			$info['information']);
    	$res = $db->query($sql);
    	if($res == true)
    	{
    		return $db->insert_id;
    	}
    	else
    		return -1;
    }
}
?>